{extend name="public/base" /}

{block name="title"}<title>用户列表</title>{/block}

{block name="pjax_container"}
<section class="content-header">
    <h1>用户列表</h1>
    <ol class="breadcrumb">
        <li class="active"><i class="fa fa-dashboard"></i> 用户列表</li>
    </ol>
</section>
<section class="content">
    <div class="row">
        <div class="col-md-12">
            <div class="box box-primary">
                <div class="box-header with-border">
                    <div class="" style="top:10px;">
                        <form action="{:search_url(['status','s_time','e_time','search'])}" method="GET" pjax-search="">
                            <div class="input-group input-group-sm">
                                <label for="" class=" ">用户状态</label>
                                <select class="select2" name="status" style="width: 100px;display: inline-block;margin: 0px 5px;padding-left: 3px;border: 1px solid #ccc;height: 28px;border-radius: 3px;">
                                    <option value="">全部</option>
                                    {volist name="userStatuslist" id="v"}
                                    <option value="{$key}"{if condition="isset($_GET['status']) && is_numeric($_GET['status']) && $_GET['status']==$key"}selected="selected"{/if}>{$v}</option>
                                    {/volist}
                                </select>
                                <label for="" class=" ">开盘通知</label>
                                <select class="select2" name="note" style="width: 100px;display: inline-block;margin: 0px 5px;padding-left: 3px;border: 1px solid #ccc;height: 28px;border-radius: 3px;">
                                    <option value="">全部</option>
                                    {volist name="user_note" id="v"}
                                    <option value="{$key}"{if condition="isset($_GET['note']) && is_numeric($_GET['note']) && $_GET['note']==$key"}selected="selected"{/if}>{$v}</option>
                                    {/volist}
                                </select>
                                <div style="width: 247px;float: right;">
                                    <input type="text" style="display: inline-block;width: 200px;margin: 0px 5px;padding-left: 3px;border: 1px solid #ccc;height: 28px;border-radius: 3px;" name="search" class="" value="{:input('get.search')}" placeholder="昵称或手机" />
                                    <div class="input-group-btn" style="display: inline-block;">
                                        <button type="submit" class="btn btn-default sreachs">
                                            <i class="fa fa-search"></i>查询
                                        </button>
                                        <button type="button" class="btn btn-default" style="margin-left:10px;" onclick="export_list(this);" url="{:url('index')}">
                                            <i class="fa fa-download"></i> 用户导出
                                        </button>
                                    </div>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
                <div class="box-body table-responsive">
                    <table class="table table-bordered table-hover">
                        <tr>
                            <th>ID</th>
                            <th>头像</th>
                            <th>昵称</th>
                            <th>手机号</th>
                            <th>出生日期</th>
                            <th>性别</th>
                            <th>积分</th>
                            <th>是否核销</th>
                            <th>开盘通知</th>
                            <th>添加称重</th>
                            <th>状态</th>
                            <th>操作</th>
                        </tr>
                        {volist name="data" id="v"}
                        <tr>
                            <td>{$v["id"]}</td>
                            <td><img width="40" height="40" src="{$v['avatar']}"></td>
                            <td>{$v["nickname"]}</td>
                            <td>{$v["mobile"]}</td>
                            <td>{$v["BirthdayStr"]}</td>
                            <td>{$v['SexStr']}</td>
                            <td>{$v['points']}</td>
                            <td>{$v['IsVerificationStr']}</td>
                            <td>{$v['NoteStr']}</td>
                            <td>
                                <a class='btn btn-primary btn-xs' href="javascript:user_weight_log_add('{$v.id}');"> 添加记录</a>
                            </td>
                            <td>{$v['StatusStr']}</td>
                            <td>
                                {:authAction(CONTROLLER_NAME.'/edit','edit',['id'=>$v['id']])}
                                {:authAction(CONTROLLER_NAME.'/delete','delete_one',['id'=>$v['id']])}
                            </td>
                        </tr>
                        {/volist}
                    </table>
                </div>
                <div class="box-footer clearfix">
                    {$data->render()}
                </div>
            </div>
        </div>
    </div>
</section>
<script>
    function user_weight_log_add(user_id) {
        layui.use('layer', function(){
            var layer = layui.layer;
            layer.open({
                type: 2,
                area: ['300px', '180px'],
                content: "{:url('user_weight_log_add')}"+"?user_id="+user_id
            });
        });
    }

    // 导出表格
    function export_list(obj){
        window.location=$(obj).attr("url")+"?is_explode=1&"+$(obj).parents('form').serialize();
    }

</script>
{/block}
